package com.llcbenwu.session;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.web.session.SessionInformationExpiredEvent;
import org.springframework.security.web.session.SessionInformationExpiredStrategy;

import javax.servlet.ServletException;
import java.io.IOException;

/**
 * @author lilinchun
 * @date 2021/11/11 0011 11:23
 */
@Configuration
public class LlcExpiredSessionStrategy implements SessionInformationExpiredStrategy {

    @Override
    public void onExpiredSessionDetected(SessionInformationExpiredEvent event) throws IOException, ServletException {
        //设置返回类型
         event.getResponse().setContentType("application/json;charset=UTF-8");
         event.getResponse().getWriter().write("并发登录");
    }
}
